Skip to content

Improve httpx instrumentation examples#3387

Merged
xrmx merged 2 commits intoopen-telemetry:mainfrom
andremm:httpx-snippet
Apr 2, 2025
Merged

Improve httpx instrumentation examples#3387
xrmx merged 2 commits intoopen-telemetry:mainfrom
andremm:httpx-snippet

Conversation

@andremm
Copy link
Copy Markdown
Member

@andremm andremm commented Mar 27, 2025

Description

Some instrumentation examples inside httpx don't run. This PR fixes the examples, so they run. It also ports the fixes to README.rst and makes indentation consistent across examples.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  1. Clone contrib repo: git clone https://github.com/open-telemetry/opentelemetry-python-contrib
  2. Clone OTel Python repo: git clone https://github.com/open-telemetry/opentelemetry-python
  3. Access the contrib repo: cd opentelemetry-python-contrib
  4. Create a virtual env: python3 -m venv otelvenv
  5. Activate the virtual env: source otelvenv/bin/activate
  6. Install common dependencies:
pip install opentelemetry-distro/ opentelemetry-instrumentation/ \
 ../opentelemetry-python/opentelemetry-semantic-conventions/ \
 ../opentelemetry-python/opentelemetry-api/ \
 ../opentelemetry-python/opentelemetry-sdk/ \
 ../opentelemetry-python/opentelemetry-proto/ \
 ../opentelemetry-python/exporter/opentelemetry-exporter-otlp-proto-common
  1. Install httpx specific requirements:
pip install -r instrumentation/opentelemetry-instrumentation-httpx/test-requirements.txt
  1. Copy the instrumentation examples inside the instrumentation main __init__.py file into different Python files and try to run them.

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@xrmx xrmx added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Mar 28, 2025
@xrmx xrmx enabled auto-merge (squash) April 2, 2025 10:30
@xrmx xrmx merged commit 3a585b4 into open-telemetry:main Apr 2, 2025
720 checks passed
@andremm andremm deleted the httpx-snippet branch April 9, 2025 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip Changelog PRs that do not require a CHANGELOG.md entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants